package demo03;

import java.util.Arrays;

public class SelectSort {
	public static void main(String[] args){
		int[] a = {5,3,7,2,1,9,8,4};
		selectSort(a);
	}
	private static void selectSort(int[] a) {
		for(int i = 0;i < a.length - 1;i++){
			for(int j = i + 1;j < a.length;j++){
				if(a[i] > a[j]){
					swap(a,i,j);
				}
			}
			System.out.println(Arrays.toString(a));
		}
	}
	private static void swap(int[] arr,int i,int j){
		int t= arr[i];
		arr[i] = arr[j];
		arr[j] = t;
		
	}
	
}
